﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace Converter
{
    public class CameraToTextColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                bool bl = bool.Parse(value.ToString());

                if (bl) //在线
                {
                    return new SolidColorBrush(Colors.White);
                }
                else //离线
                {
                    return new SolidColorBrush(Colors.Gray);
                }
            }
            catch
            {
                return new SolidColorBrush(Colors.White);
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
